<% content_for :css do %>
  <%= stylesheet_link_tag 'index','materials_index' %>
<% end %>
<% content_for :title do %>-相关材质<% end %>
<div class='body'>
  <div class='top'>
    <div class='title'>
      <b>基础数据</b><span>相关材质</span>
    </div>
  </div>
  <div class="search">
    <%= form_tag materials_url,
          :method => :get do %> 
      <%= hidden_field_tag :target, params[:target] %>
      <%= text_field_tag :key_words, params[:key_words] ,:class => :search, :onfocus => 'select()' %>
      <%= submit_tag '查找材质', :class => :bb %>
      <%= link_to '新增材质', new_material_url,  :class => :new %>
    <% end %>
  </div>
  <div class="page">
    <div class="total_currnet"><p>共</p><b><%= @materials.size %></b><p>种材质</p></div>
  </div>
  <div class="index">  
    <% @materials.each do |material| %>
    <div id='material_<%= material.id %>' class="monomer">
      <div class="content">
        <div class="title">
          <div class="name">
            <b><%= material.code %></b><%= material.name %>
          </div>
          <div class="information">
            <p class="statistics">
              <%= material.factory.name %>
            </p>
          </div>
        </div>      
        <div class="article">
          <%= material.remark %>
        </div>
      </div>
      <div class="operate">
        <%= link_to '修改',edit_material_url(material), :class => 'button' %>
        <% if material.status.visible? %>
        <%= link_to '隐藏',
              hide_material_url(material),
              :confirm => '确认要设置为隐藏吗？',
              :method => :put,
              :class => 'button',
              :id => "hide_material_#{material.id}_link"
         %>
         <% else %>
         <%= link_to '可见',
              visible_material_url(material),
              :confirm => '确认要设置为可见吗？',
              :method => :put,
              :class => 'button',
              :id => "visible_material_#{material.id}_link"
         %>
         <% end %>
      </div>
    </div>
    <% end %>
  </div>
  <div class="page">
    <div class="total_currnet"><p>共</p><b><%= @materials.size %></b><p>种材质</p></div>
  </div>  
</div>

        